class CreateDeskActionAggregates < ActiveRecord::Migration
  def self.up
    create_table :desk_action_aggregates do |t|
      t.column :type, :string
      t.column :freshman_id, :int
      t.column :start_action_id, :int
      t.column :end_action_id, :int
      t.column :house_id, :int
      t.column :jaunt_id, :int
    end
    drop_table :freshman_jaunts
    drop_table :house_visits
    drop_table :overnights
  end

  def self.down
    drop_table :desk_action_aggregates
    create_table "house_visits", :force => true do |t|
      t.column "freshman_id", :integer, :default => 0, :null => false
      t.column "house_id", :integer, :default => 0, :null => false
      t.column "entrance_id", :integer
      t.column "exit_id", :integer
    end
    create_table "freshman_jaunts", :force => true do |t|
      t.column "freshman_id", :integer, :default => 0, :null => false
      t.column "jaunt_id", :integer, :default => 0, :null => false
      t.column "departure_id", :integer
      t.column "jaunt_return_id", :integer
    end
    create_table "overnights", :force => true do |t|
      t.column "freshman_id", :integer, :default => 0, :null => false
      t.column "house_id", :integer, :default => 0, :null => false
      t.column "specified_wakeup_time", :datetime, :null => false
      t.column "actual_wakeup_time", :datetime
      t.column "overnight_recorded_at", :datetime, :null => false
      t.column "wakeup_recorded_at", :datetime
    end
  end
end
